#!/bin/bash

# curl -L "https://gitee.com/honjow/sk-chos-scripts/raw/master/install-mesa-25-2.sh" | sh

# GITHUB_PREFIX="https://ghproxy.homeboyc.cn/https://github.com"
GITHUB_PREFIX="https://github.com"

PACKAGE_OVERRIDES="\
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-mesa-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-opencl-mesa-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-vulkan-intel-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-vulkan-mesa-layers-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-vulkan-nouveau-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-vulkan-radeon-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-vulkan-swrast-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/lib32-vulkan-virtio-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/mesa-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/mesa-docs-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/opencl-mesa-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/vulkan-intel-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/vulkan-mesa-layers-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/vulkan-nouveau-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/vulkan-radeon-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/vulkan-swrast-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
	${GITHUB_PREFIX}/3003n/mesa-sk/releases/download/25.2.0.rc1-sk1-2/vulkan-virtio-1--25.2.0.rc1.sk1-2-x86_64.pkg.tar.zst \
"

tmp_dir="/tmp/extra_pkgs_233"

mkdir -p $tmp_dir
rm -rf $tmp_dir/*

if [ -n "${PACKAGE_OVERRIDES}" ]; then
	wget --directory-prefix="$tmp_dir" ${PACKAGE_OVERRIDES}
fi

pikaur --noconfirm -U --overwrite '*' $tmp_dir/*